home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 49
/
Amiga Format CD49 (2000-01-17)(Future Publishing)(GB)(Track 1 of 3)[!][issue 2000-02].iso
/
-serious-
/
comms
/
other
/
amigancp_21
/
developer
/
source
/
s3run
/
s3run.c
< prev
next >
Wrap
C/C++ Source or Header
|
1999-11-29
|
860b
|
62 lines
/*
** Run a program on the S3
*/
#include <proto/dos.h>
#include <libraries/ncplib.h>
int main( int argc, char **argv )
{
int rc;
char buff[ 128 ], buff2[ 4 ];
int c = 0;
char *p;
if( argc < 2 )
{
PutStr( "Usage: S3Run remotefilename [cmdline]\n" );
return( 5 );
}
if( argc > 2 )
{
// Acceppt \xx escapes
p = argv[ 2 ];
for( c = 0; *p; )
{
if( *p == '\\' )
{
p++;
if(*p=='\\' )
buff[ c++ ] = *p++;
else
{
buff2[ 0 ] = *p++;
buff2[ 1 ] = *p++;
buff2[ 2 ] = 0;
stch_l( buff, &rc );
buff[ c++ ] = rc;
}
}
else
{
buff[ c++ ] = *p++;
}
}
}
rc = NCP_LinkRemoteRun( argv[ 1 ], buff, c );
if( !rc )
{
PutStr( "S3Run: Ok\n" );
return( 0 );
}
else
{
NCP_Fault( rc, "S3Run", buff, 128 );
Printf( "NCP returned %ld (%s)\n", rc, buff );
return( 5 );
}
}